package se.lnu.axez;

import se.lnu.axez.physics.bullet.PhysicsManager;
import se.lnu.axez.shaders.ShaderManager;
import se.lnu.axez.textures.TextureManager;
import android.content.Context;

public final class AxezContext {
	static final int CAMERA_PICK_COORDINATES_OFFSET = 0;
	static final int PICK_RAY_COORDINATES_OFFSET = CAMERA_PICK_COORDINATES_OFFSET + 2;
	
	final float[] values = new float[PICK_RAY_COORDINATES_OFFSET + Constants.GL_VECTOR_SIZE * 2];

	boolean needRayTest = false;
	private final Context androidContext;
	private final RenderMatrices renderMatrices;
	private final TriMeshManager triMeshManager;
	private final ShaderManager shaderManager;
	private final TextureManager textureManager;
	private final PhysicsManager physicsManager;
	float pickDistance;
	Object pickedObject;

	AxezContext(
			Context context,
			RenderMatrices renderMatrices, 
			TriMeshManager triMeshManager, 
			ShaderManager shaderManager,
			TextureManager textureManager,
			PhysicsManager physicsManager) {
		this.androidContext = context;
		this.renderMatrices = renderMatrices;
		this.triMeshManager = triMeshManager;
		this.shaderManager = shaderManager;
		this.textureManager = textureManager;
		this.physicsManager = physicsManager;
	}

	void reportPickedObject(float distance, Object o) {
		if (this.pickDistance > distance) {
			this.pickedObject = o;
		}
	}
	
	public RenderMatrices getRenderMatrices() {
		return this.renderMatrices;
	}

	public TriMeshManager getTriMeshManager() {
		return this.triMeshManager;
	}

	public ShaderManager getShaderManager() {
		return this.shaderManager;
	}
	
	public TextureManager getTextureManager() {
		return this.textureManager;
	}

	public PhysicsManager getPhysicsManager() {
		return this.physicsManager;
	}
}
